@import 'variables';
@import 'mixins';
@import 'config/import';

.dashboard-container {
  .manage-header {
    background: $bold-blue;
  }

  .single-article {
    padding: 5px 15px;
    @include dev-card;
    position: relative;
    overflow: auto;
    &.thanks-for-suggesting-a-tweet {
      background: lighten($green, 20%);
      padding: 30px 0px;
      text-align: center;
      font-size: 1.4em;
      font-weight: bold;
    }

    .dashboard-collection-org-details {
      .dashboard-top-pill {
        @include themeable(
          background,
          theme-container-accent-background,
          darken($light-gray, 6%)
        );
        color: var(--body-color);
        margin-right: 5px;
        padding: 3px 10px;
        border-radius: 100px;
        margin-top: 10px;
        display: inline-block;
        font-size: 0.9em;
      }
    }

    .dashboard-meta-details {
      font-size: 0.85em;
      padding: 3px 0px 6px;
      color: var(--card-color-tertiary);
    }

    h2 {
      font-weight: 500;
      margin-bottom: 10px;
      margin-top: 8px;
      font-size: 22px;
      overflow: auto;
      display: inline-block;

      @media screen and (min-width: 800px) {
        font-size: 34px;
      }

      width: 100%;

      .block-link {
        display: inline;
      }

      img {
        height: 40px;
        width: 40px;
        border-radius: 80px;
        vertical-align: -8px;
      }

      .dashboard-username {
        color: $medium-gray;
        font-size: 0.6em;
        vertical-align: 0.16em;
      }

      .dashboard-follow {
        @include themeable(
          background,
          theme-dashboard-followers-follow-background,
          $green
        );
        border: 0;
        border-radius: 5px;
        @include themeable(
          color,
          theme-dashboard-followers-follow-color,
          $black
        );
        font-size: 15.9px;
        padding: 2px 10px;
        @media screen and (min-width: 520px) {
          font-size: 20px;
        }
        &.follow-tag {
          @media screen and (min-width: 750px) {
            margin: 8px 0px 8px 10px;
          }
        }
        &.follow-user {
          float: right;
          margin-top: 8px;
        }
      }

      .follow-tag-actions {
        @media screen and (min-width: 750px) {
          float: right;
        }
      }

      form {
        @include themeable(
          background,
          theme-container-accent-background,
          $light-gray
        );
        padding: 8px 15px;
        margin-bottom: 10px;
        border-radius: 3px;

        @media screen and (min-width: 750px) {
          display: inline-block;
        }

        input {
          font-size: 16px;
          border-radius: 3px;
          padding: 3px 8px;
          width: 50px;
          border: 1px solid $black;
          font-weight: bold;

          &[type='submit'] {
            width: auto;
            background: $green;
            font-family: $helvetica-condensed;
            margin-left: 5px;
          }
        }
      }
    }

    h4 {
      margin-top: 0px;
      margin-bottom: 9px;
      margin-left: 2px;
      font-weight: 300;
      font-size: 16px;
      color: rgb(67, 78, 87);
    }

    .dashboard-actions {
      padding: 7px 0px 10px;

      form {
        margin: 0;
        padding: 0;
        display: inline;
      }
    }

    .dashboard-pageviews-indicator {
      display: inline-block;
      font-family: var(--ff-monospace);
      color: $dark-gray;
      background: white;
      text-align: center;
      padding: 2px 8px;
    }

    form {
      padding: 10px 0px;
      font-size: 15px;
      font-stretch: condensed;

      select {
        margin: 0px 4px;
        vertical-align: 2px;
      }

      input[type='submit'] {
        border: 0px;
        font-size: 15px;
      }
    }

    .single-article__details {
      margin: 10px 0px;

      .user {
        color: $medium-gray;
      }

      .tag {
        margin-left: 10px;
      }
    }
  }
}

.analytics-container {
  max-width: 1400px;
  margin: 0 auto;
}

.crayons-tabs--analytics {
  width: min-content;
  margin: var(--su-1) auto var(--su-4);
  @media screen and (min-width: 800px) {
    margin: var(--su-1) var(--su-4) var(--su-4);
  }
}

$column-flex: 1;

.summary-stats {
  text-align: center;
  display: flex;
  justify-content: space-between;

  &__col {
    flex: $column-flex;
    min-height: 100px;
  }
}

.crayons-tabs--analytics {
  justify-content: center;
}

.graphs {
  display: flex;
  justify-content: space-between;
  &__col {
    flex: $column-flex;
  }
  .charts-container {
    padding: var(--su-4);
    height: 320px;
    canvas {
      min-height: 280px;
      max-height: 280px;
    }
  }
}

@media screen and (max-width: $breakpoint-s) {
  .summary-stats,
  .graphs {
    display: block;
    &__col {
      display: block;
      width: 90%;
      margin: 10px auto;
    }
  }

  .crayons-tabs--analytics {
    width: 100%;
  }
}

.card {
  @include themeable(border, theme-container-border, 1px solid #d6d6d6);
  @include themeable(
    box-shadow,
    theme-container-box-shadow,
    3px 3px 0px #bababa
  );
  border-radius: 3px;
  padding: 20px;
  margin: 5px;
  @include themeable(background-color, theme-container-background, #fff);

  h4 {
    font-size: 0.8em;
    margin: 0px;
    padding: 0px;
  }

  .stat-percentage {
    font-size: 0.8em;
  }

  table {
    margin: 1rem auto;
    text-align: left;
    width: 50%;

    thead {
      line-height: 3rem;

      th:last-child {
        text-align: right;
      }
    }

    tbody {
      line-height: 2rem;

      td:last-child {
        text-align: right;
      }
    }
  }
}

.featured-stat {
  font-size: 2em;
  font-weight: bold;
}

.header-card {
  max-width: 100%;
}

.dashboard-manage-header {
  background: darken($bold-blue, 25%);
  color: white;
  padding: 32px 0;
  line-height: 1.3em;
  box-shadow: 0 100px 0 darken($bold-blue, 25%);
  .manage-page-error {
    background: $red;
    color: white;
    padding: 20px 10px;
    line-height: 1.4em;
    border-radius: 3px;
  }
  .manage-page-success {
    background: $green;
    padding: 20px 10px;
    line-height: 1.4em;
    border-radius: 3px;
  }
  li {
    margin: 20px auto;
  }
  a {
    color: white;
    text-decoration: underline;
  }
  .dashboard-manage-header-inner-container {
    width: 800px;
    max-width: 96%;
    margin: 10px auto;
  }
  .dashboard-manage-nav {
    padding: 10px 0px;
    font-size: 0.9em;
    font-weight: bold;
  }
}

// dashboard pages
.dashboard__tag__container {
  height: 195px;
  justify-content: space-between;

  .crayons-tag {
    padding-top: 0;
    padding-bottom: 0;
  }
}

// Manage page with sidebar
.manage-page-with-sidebar {
  display: flex;
  gap: var(--su-4);
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--su-4);

  @media screen and (max-width: 1023px) {
    flex-direction: column;
    padding: var(--su-2);
  }
}

.manage-sidebar {
  position: sticky;
  top: var(--su-4);
  flex: 0 0 240px;
  height: fit-content;
  padding: var(--su-4);

  @media screen and (max-width: 1023px) {
    position: static;
    flex: 1;
  }

  @media screen and (max-width: 639px) {
    padding: var(--su-3);
  }
}

.manage-sidebar-title {
  font-size: var(--fs-l);
  font-weight: var(--fw-bold);
  margin: 0 0 var(--su-4) 0;
  color: var(--card-color);
}

.manage-sidebar-nav {
  ul {
    list-style: none;
    padding: 0;
    margin: 0;
  }
}

.manage-sidebar-list {
  li {
    margin: 0;
  }
}

.manage-sidebar-link {
  display: block;
  padding: var(--su-2) var(--su-3);
  margin-bottom: var(--su-1);
  color: var(--card-color);
  text-decoration: none;
  border-radius: var(--radius);
  transition: all var(--transition-props);
  font-weight: var(--fw-medium);

  &:hover {
    background: var(--card-secondary-bg);
    color: var(--card-color);
    text-decoration: none;
  }

  &.active {
    background: var(--accent-brand);
    color: var(--base-inverted);
    font-weight: var(--fw-bold);

    &:hover {
      background: var(--accent-brand-darker);
      color: var(--base-inverted);
    }
  }
}

.manage-main-content {
  flex: 1;
  min-width: 0; // Prevents flex item from overflowing

  @media screen and (max-width: 1023px) {
    width: 100%;
  }
}

// Handle main sidebar overlap on medium-sized screens
body[data-side-nav-visible='true']:not(.hidden-shell) {
  .manage-page-with-sidebar {
    @media (min-width: $breakpoint-m) {
      max-width: calc(1280px - 50px);
      width: calc(100% - 50px);
      margin-left: 50px;
    }
    @media (min-width: $breakpoint-2xl) {
      max-width: 1280px;
      width: 100%;
      margin-left: auto;
      transform: translateX(20px);
    }
  }
}
